<?PHP
/**
 * 首页
 * 
 * @copyright Copyright (c) 2008 sdmblog (http://www.sdmblog.cn)
 * @author sdomain(sdomain@live.cn)
 * @version index.php Sun May 18 14:08:29 CST 2008 php $
 */
include_once('./include/common.inc.php');
require_once ("./xajax/inc/xajax.inc.php");
//global $lan;
//$db->query("select * from sdm_articles");

//如下的代码可以让其支持URL方式,而并不能只能是AJAX方式
$category = $_GET['C'];
$page = $_GET['P'];
$date = $_GET['D'];
if (!ereg("^[0-9]{4}(-[0-9]{1,2}){1,2}$",$date)) {
	$date = '';
}
$category = is_numeric($category)&&$category>0?$category:0;
$page = is_numeric($page)&&$page>0?$page:0;
if ($category>0) {
	$param1 = 'category';
	$param2 = $category;
}
if (!empty($date)) {
	$param1 = empty($param1)?'date':($param1.','.'date');
	$param2 = empty($param2)?$date:($param2.','.$date);
}
$smarty->assign('page',$page);
$smarty->assign('param1',$param1);
$smarty->assign('param2',$param2);


//--------------------------页面初始化时的一些设置----------------------
$xajax = new xajax('/'.$virdir."class/index.class.php");
//显示文章列表
$xajax->registerFunction("getArticleList");
//显示公告
$xajax->registerFunction("getAnnounce");
//显示分类列表
$xajax->registerFunction('getCategoryList');
//日历
$xajax->registerFunction('getCalendar');
//显示最新文章
$xajax->registerFunction('getRecentArticles');
//显示回复
$xajax->registerFunction('getComment');
//网站统计
$xajax->registerFunction('getStats');
//友情连接
$xajax->registerFunction('getLinks');
//用户登录
$xajax->registerFunction('userLogin');

$ajaxscript=$xajax->getJavascript('/'.$virdir.'./xajax/inc/');
$smarty->assign('ajaxscript',$ajaxscript);
$smarty->assign('articleload',$lang['LOADING_ARTICLES']);
$smarty->assign('loading',$lang['LOADING']);
$smarty->assign('title','首页');


//--------------------------回载模板------------------------------------
$smarty->display("index.tpl");
?>